<?php
$user = "root"; 
$pass = "";
$host = "localhost";
$table = "web1";

mysql_connect($host,$user,$pass);
@mysql_select_db($dbase) or die("Ket noi that bai");
if( isset($_POST['q']) )
{
$var = $_POST['q'];

$query = "SELECT * FROM $table WHERE ask LIKE '%$var%' order by faq_id";
$result = mysql_query($query);
$numrows=mysql_num_rows($result);
if ($numrows == 0) 
{
echo "Kết quả";
echo "in lỗi không tìm thấy " . $var . " trong cơ sở dữ liệu";
exit; 
}

while ($r= mysql_fetch_array($result))
{

echo $r["faq_id"];
echo $r["ask"];
echo $r["answer"];
}
}
else { echo " khong tim thay data";
{


?>

<?phpendforeach; ?>

<form name="search" method="POST" action=">



      